package org.prail.net.core;

import java.net.URL;
import java.net.URLConnection;

import javazoom.jl.player.Player;

public class Stream {
	private static Player player = null;

	public Stream(String mp3url) {
		try {
			if(player != null) {
				player.close();
			}
			URLConnection urlConnection = new URL ( mp3url ).openConnection ();
			urlConnection.connect();
			player = new Player ( urlConnection.getInputStream () );
	        player.play ();
	        
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static Player getPlayer() {
		return player;
	}

}
